package org.zhs.decorate.demo2;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

/**
 * Author: zhs
 * Date: 16/05/2024 17:17
 * Description:
 */
public class CompressionDecorator extends DataSourceDecorate{

    public CompressionDecorator(DataSource dataSource){
        this.dataSource = dataSource;
    }

    @Override
    public String readData() {
        String data = super.readData();
        try {
            return URLDecoder.decode(data, "utf-8");
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }
}
